home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / tool / dolmorph / src / domorph.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-12  |  1.8 KB  |  68 lines

  1. #ifndef    HEADER_DOMORPH
  2. #define    HEADER_DOMORPH
  3.  
  4. #include "fifo.h"
  5.  
  6. typedef    int        fxp;
  7.  
  8. #define    DO_MORPH        0
  9. #define    DO_TRANSFORM    1
  10.  
  11. #define    SHIFT        16
  12. #define    UNIT        (0x10000)
  13. #define    HUNIT        (0x08000)
  14. #define    FP2FX(n)    ((int)((float)(n)*(float)0x10000))
  15. #define    FX2FP(n)    ((float)(n) / (float)0x10000)
  16. #define    I2FX(n)        ((n)<<SHIFT)
  17. #define    FX2I(n)        (((n)+HUNIT)>>SHIFT)
  18.  
  19. typedef struct {
  20.     int    x,y;
  21. } PXY;
  22.  
  23. typedef struct {
  24.   PXY from,to;
  25. } MORPH_POINT;
  26.  
  27. typedef struct {
  28.   PXY from1,from2; /* 変形前の線 */
  29.   PXY to1,to2;     /* 変形後の線 */
  30. } MORPH_LINE;
  31.  
  32. typedef struct {
  33.     int        varType;    // 現在計算中の対応座標配列
  34.                         // 0:from_x 1:from_y 2:to_x 3:to_y
  35.     int        loopCnt;    // 収束計算の何回目のループか
  36.     fxp        moveMax;    // 最大移動量
  37.     fxp        moveLimit;    // 収束限界値
  38.     int        morphType;
  39. } MORPH_INFO;
  40.  
  41. /*  もーふの初期化  */
  42. /* width*height:出力画像サイズ */
  43. /* limit:どのくらいの誤差を許すか。普通は0.01位。値を小さくすると高画質で時間がかかる */
  44. /* point_num:点指定境界条件数  point:点指定境界条件 */
  45. /* line_num:線指定境界条件数   line:線指定境界条件数 */
  46. /* 線指定境界条件は連続してコネクトさせると輪郭の指定などができる */
  47. extern void morphInitialize(int width,int height,float limit,LIST *plPOINT,LIST *plLINE);
  48.  
  49. /*  もーふの終了  */
  50. extern void morphTerminate();
  51.  
  52. /*  もーふ計算の実行  */
  53. /* time : 0=変化前   0<中間画像<1   1=変化後 */
  54. int morphExec(float time, int (*func)(MORPH_INFO *info), int callCnt,
  55.                int do_type);
  56.  
  57. /*  もーふ計算した色を取り出す  */
  58. extern void morphGetColor(int x,int y,  int *r,int *g,int *b);
  59.  
  60. /*   ユーザー側で定義する関数。必ず必要!!
  61. extern void morphGetFromPixel(fxp x,fxp y,  int *r,int *g,int *b);
  62. extern void morphGetToPixel(fxp x,fxp y,  int *r,int *g,int *b);
  63. */
  64.  
  65. void morphDumpOut(char *filename,int wid,int ht);
  66.  
  67. #endif
  68.